package com.yunlongn.common.json;

import com.yunlongn.common.json.config.JsonConfig;
import com.yunlongn.common.json.config.SerializeConfig;
import com.yunlongn.common.json.jackson.Onk;
import com.yunlongn.common.json.jackson.factory.AbstractJsonSerializer;
import com.yunlongn.common.json.jackson.serializer.StringSerializer;

import java.util.HashMap;
import java.util.Map;

public class Test {
    public static void main(String[] args) {
        Onk a = new Onk();
        a.setA("1");
        JsonConfig jsonConfig = new JsonConfig();
        SerializeConfig serializeConfig = new SerializeConfig();
        serializeConfig.setTimezone(9);
//        jsonConfig.setSerializeConfig(serializeConfig);

//        JsonUtils.resetSerializeConfig(jsonConfig);
        Map<Class<?>, AbstractJsonSerializer<?>> jsonDeserializerMap = new HashMap<>();
        jsonDeserializerMap.put(String.class, new StringSerializer());
        System.out.println(JsonUtils.toJsonString(a, jsonDeserializerMap));
        serializeConfig.setTimezone(10);
        JsonUtils.resetSerializeConfig(jsonConfig);
        System.out.println(JsonUtils.toJsonString(a));
        System.out.println(JsonUtils.toJsonString(a));
        System.out.println(JsonUtils.toJsonString(a, jsonDeserializerMap));
        System.out.println(JsonUtils.toJsonString(a));
    }
}
